<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateJobScopesTable extends Migration
{
    /**
     * Run the migrations.
     *运营管理->基础数据导入->环卫部件导入->道路、区域基础信息
     *
     * @return void
     */
    public function up()
    {
        Schema::create('job_scopes', function (Blueprint $table) {
            $table->increments('id');
            $table->string('number')->comment('道路编号');
            $table->string('road_name')->comment('道路名称');
            $table->integer('road_level')->unsigned()->comment('道路等级 0一级 1二级 2三级')->nullable();
            $table->integer('type')->unsigned()->comment('幅路类型 0一幅路 1二幅路 2三幅路 3四幅路')->nullable();
            $table->integer('area_id')->unsigned()->comment('城市id')->nullable();
            // $table->string('area_name')->comment('区域名称')->nullable();
            $table->integer('category')->unsigned()->comment('道路类型 0道路 1天桥 2高架道路 3步行街')->nullable();
            $table->foreign('area_id')->references('id')->on('carareas')->onDelete('set null');
            $table->string('road_origin')->comment('起点')->nullable();
            $table->string('road_destination')->comment('终点')->nullable();
            $table->polygon('areas')->comment('道路区域')->nullable();
            $table->string('road_length')->comment('道路长度')->nullable();
            $table->string('road_width')->comment('道路宽度')->nullable();
            $table->string('motor_length')->comment('机动车道长度')->nullable();
            $table->string('motor_width')->comment('机动车道宽度')->nullable();
            $table->string('non-motor_length')->comment('非机动车道长度')->nullable();
            $table->string('non-motor_width')->comment('非机动车道宽度')->nullable();
            $table->string('sidewalk_length')->comment('人行道长度')->nullable();
            $table->string('sidewalk_width')->comment('人行道宽度')->nullable();
            $table->string('other_length')->comment('其他道长度')->nullable();
            $table->string('other_width')->comment('其他道宽度')->nullable();
            $table->string('road_areas')->comment('作业面积')->nullable();
            // $table->string('machine_task')->comment('机扫任务量')->nullable();
            // $table->string('watering_task')->comment('洒水任务量')->nullable();
            // $table->string('watering')->comment('洒水频次')->nullable();
            // $table->string('sidewalk')->comment('人行道养护')->nullable();
            // $table->string('dustfall')->comment('炮雾车/降尘');
            $table->string('length_unit')->comment('长度单位')->default('米')->nullable();
            $table->string('area_unit')->comment('面积单位')->default('㎡')->nullable();
            $table->string('mode')->comment('清扫模式')->nullable();
            $table->char('facilities',20)->comment('分割设施 1=绿化带 2=防护栏 3=分割线')->nullable();
            $table->text('details')->comment('设施详情 json数据')->nullable();
            $table->string('remake')->comment('备注')->nullable();
            $table->integer('parent_id')->unsigned()->comment('父级id')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('job_scopes');
    }
}
